<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name=viewport content="with=device-width,initial-scale=1.0">
<link href="../resource/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link href="../resource/css/basic.css" rel="stylesheet">
<script src="../resource/js/jquery.min.js"></script>
<script src="../resource/bootstrap/js/bootstrap.min.js"></script>
<script src="../resource/js/lesson.js"></script>
<script src="../resource/js/user.js"></script>
<script src="../resource/ueditor/ueditor.config.js"></script>
<script src="../resource/ueditor/ueditor.all.js"></script>

<script>
	$(function() {
		$('#btnLogout').click(logout);
		$('#typeList select[name=department]>option').click(
				getLessonTwoTypeList);
		var $logoEditor = new UE.ui.Editor({
			toolbars : [ [ 'insertimage' ] ],
			autoHeightEnabled : false
		});
		$logoEditor.render('logoEditor');
		$logoEditor.ready(function() {
			$logoEditor.hide();//隐藏编辑器
		});
		var $description = new UE.ui.Editor({
			//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个  
			toolbars : [ [ 'bold' ] ],
			//focus时自动清空初始化时的内容  
			autoClearinitialContent : true,
			//关闭字数统计  
			wordCount : false,
			//关闭elementPath  
			elementPathEnabled : false,
			//默认的编辑区域高度  
			initialFrameHeight : 200
		//更多其他参数，请参考ueditor.config.js中的配置项  
		});
		$description.render('description');
		var $synopsis = new UE.ui.Editor();
		$synopsis.render('synopsis');
		//监听图片上传
		$logoEditor.on('beforeInsertImage', function(t, arg) {
			$('#lesson [name=logo]').attr('src', arg[0].src);
		});
		$('#imgUpload').click(function() {
			var myImage = $logoEditor.getDialog('insertimage');
			myImage.open();
		});
		$('#lessonCommit').click(addLesson);
	});
</script>
<title>创建新课程</title>
</head>
<body>
	<nav class="navbar navbar-fixed-top navbar-primary" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
			<img class="img-responsive" src="../resource/image/header3.png" />
		</div>
			<ul class="user nav navbar-nav navbar-right">
				<li><a href="#">欢迎您， <img class="img-circle"
						style="height: 18px" src="${teacher.logo }" /> ${teacher.petName}
				</a></li>
				<li><a href="#"><i class="glyphicon glyphicon-comment"></i>
						我 的 消 息</a></li>
				<li><a id="btnLogout" href="#" data-roles="teacher"><i
						class="glyphicon glyphicon-off"></i> 退 出 登 录</a></li>
			</ul>
		</div>
	</nav>
	<div>
		<div class="col-sm-2">
			<div class="row panel panel-default">
				<div class="panel-body">
					<div class="row panel panel-default">
						<div class="panel-body">
							<div class="list-group">
								<a class="list-group-item" href="../teacher"><i
									class="glyphicon glyphicon-user"></i> 首页导航</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="studentInfo"><i
									class="glyphicon glyphicon-user"></i> 学生管理</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="lessonInfo"><i
									class="glyphicon glyphicon-book"></i> 课程管理 <span class="badge">2</span></a>
								<a class="list-group-item active" href="publishLesson"><i
									class="glyphicon glyphicon-edit"></i> 课程发布</a> <a
									class="list-group-item" href="publishLessonContent"><i
									class="glyphicon glyphicon-edit"></i> 课题发布</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="resourceUpload"><i
									class="glyphicon glyphicon-cloud-upload"></i> 资料上传</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="publishExam"><i
									class="glyphicon glyphicon-dashboard"></i> 考试发布</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="#"><i
									class="glyphicon glyphicon-tag"></i> 题库管理 <span class="badge">1</span></a>
								<a class="list-group-item" href="#"><i
									class="glyphicon glyphicon-pencil"></i> 添加答题</a>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="lesson" class="col-sm-10">
			<div class="row panel panel-default">
				<div class="panel-heading">
					<ol class="breadcrumb">
						<li><a href="../teacher"><i
								class="glyphicon glyphicon-home"></i> 首页</a></li>
						<li><a href="lessonInfo"><i
								class="glyphicon glyphicon-book"></i> 课程管理</a></li>
						<li class="active"><i class="glyphicon glyphicon-edit"></i> 课程发布</li>
					</ol>
				</div>
				<div class="panel-body">
					<div class="form-group">
						<label class="col-sm-2 control-label text-right">课程名：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="lessonTitle"
								placeholder="请输入课程名">
						</div>
					</div>
					<br /><br />
					<div id="typeList" class="form-group">
						<label class="col-sm-2 control-label text-right">课程类别：</label>
						<div class="col-sm-4">
							<select class="form-control" name="department">
							<c:forEach items="${lessonOneType}" var="lot">
								<option value="${lot.id }">${lot.typeName }</option>
							</c:forEach>
						</select>
						</div>
						<div class="col-sm-4">
							<select class="form-control" name="major">
							<c:forEach items="${lessonOneType[0].lessonTwoType}" var="ltt">
								<option value="${ltt.id }">${ltt.typeName }</option>
							</c:forEach>
						</select>
						</div>
					</div>
					<br /><br />
					<div class="panel panel-default">
						<div class="panel-heading">logo上传</div>
						<div class="panel-body">
							<img name="logo" src="/SchoolEducationSystem/resource/image/no_photo.jpg" />
							<textarea id="logoEditor" rows="0" cols="0"></textarea>
							<br />
							<button id="imgUpload" class="btn btn-success" type="button">选择图片...</button>
						</div>
					</div>
						<div class="panel panel-default">
							<div class="panel-heading">课程描述</div>
							<div class="panel-body">
								<textarea id="description" rows="0" cols="0"></textarea>
							</div>
						</div>
						<div class="panel panel-default">
							<div class="panel-heading">课程简介</div>
							<div class="panel-body">
								<textarea id="synopsis" rows="0" cols="0"></textarea>
							</div>
						</div>
					</div>
					<button id="lessonCommit" class="btn btn-danger btn-lg btn-block">提 交</button>
				</div>
			</div>
	</div>
</body>
</html>